package com.haoan.index.service.impl;


import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.haoan.index.common.enums.ValiFlag;

import com.haoan.index.mapper.AnnualPlaceMapper;
import com.haoan.index.domain.AnnualPlace;
import com.haoan.index.service.AnnualPlaceService;

/**
 * 年卡下景区列Service业务层处理
 * 
 * @author autoGen
 * @date 2025-01-03
 */
@Service
public class AnnualPlaceServiceImpl extends ServiceImpl<AnnualPlaceMapper,AnnualPlace> implements AnnualPlaceService
{
    /**
     * 查询年卡下景区列
     * 
     * @param id 年卡下景区列主键
     * @return 年卡下景区列
     */
    @Override
    public AnnualPlace selectAnnualPlaceById(Long id)
    {
        return baseMapper.selectById(id);
    }

    /**
     * 查询年卡下景区列列表
     * 
     * @param annualPlace 年卡下景区列
     * @return 年卡下景区列
     */
    @Override
    public List<AnnualPlace> selectAnnualPlaceList(AnnualPlace annualPlace)
    {
        LambdaQueryWrapper<AnnualPlace> queryWrapper = new LambdaQueryWrapper<>();
        //todo 添加查询条件
        queryWrapper.eq(annualPlace.getId() != null, AnnualPlace::getId, annualPlace.getId());
        queryWrapper.eq(annualPlace.getAnnualId() != null, AnnualPlace::getAnnualId, annualPlace.getAnnualId());
        queryWrapper.eq(annualPlace.getPlaceId() != null, AnnualPlace::getPlaceId, annualPlace.getPlaceId());
        queryWrapper.eq(annualPlace.getCreateTime() != null, AnnualPlace::getCreateTime, annualPlace.getCreateTime());
        return baseMapper.selectList(queryWrapper);
    }

    /**
     * 新增年卡下景区列
     * 
     * @param annualPlace 年卡下景区列
     * @return 结果
     */
    @Transactional
    @Override
    public int insertAnnualPlace(AnnualPlace annualPlace)
    {
        return baseMapper.insert(annualPlace);
    }

    /**
     * 修改年卡下景区列
     * 
     * @param annualPlace 年卡下景区列
     * @return 结果
     */
    @Transactional
    @Override
    public int updateAnnualPlace(AnnualPlace annualPlace)
    {
        return baseMapper.updateById(annualPlace);
    }

    /**
     * 批量删除年卡下景区列
     * 
     * @param ids 需要删除的年卡下景区列主键
     * @return 结果
     */
    @Transactional
    @Override
    public int deleteAnnualPlaceByIds(Long [] ids)
    {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除年卡下景区列信息
     * 
     * @param id 年卡下景区列主键
     * @return 结果
     */
    @Transactional
    @Override
    public int deleteById(Long id)
    {
        return baseMapper.deleteById(id);
    }
}
